/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sessions;

import javax.naming.*;
import javax.sql.*;
import java.sql.*;

/**
 *
 * @author miniyo
 */
public class ConexionBean {

    public Connection getConnection() {
        Connection con = null;
        try {
            InitialContext ic = new InitialContext();
            System.out.println("Antes de la conexion pool");
            //DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/myDatasourceTrfSgr");
            DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/myDatasourceDatosSeguros");
            System.out.println("Despues de la conexion pool");
            con = ds.getConnection();
        } catch (Exception e) {
            System.out.println("Fallo en la conexion al pool! - " + e);
        }
        return con;
    }
}
